﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework.Constraints;
using Simhopp.Model;

namespace NUnit.Framework.Tests
{
    [TestFixture]
    class TestCompetitionList
    {
        [Test]
        public void AddCompetition()
        {
            CompetitionList competitionList = new CompetitionList();
            Competition competition = new Competition();
            competitionList.AddCompetition(competition);
            Assert.AreEqual(competitionList.competitionList.Count() == 1, true);
            //Assert.AreEqual(competitionList.competitionList.Count() == 2, true);
        }

        [Test]
        public void RemoveCompetition()
        {
            CompetitionList competitionList = new CompetitionList();
            Competition competition = new Competition();
            competitionList.AddCompetition(competition);
            Assert.AreEqual(competitionList.competitionList.Count() == 1, true);
            competitionList.RemoveCompetition(competition);
            Assert.AreEqual(competitionList.competitionList.Count() == 0, true);
        }

        [Test]
        public void UpdateCompetition()
        {
            bool equal = false;
            CompetitionList competitionList = new CompetitionList();
            Competition competition = new Competition();
            competitionList.AddCompetition(competition);
            Competition updatedCompetition = new Competition("VM", CompetitionType.International, "Sala", 
                new DateTime(2014, 02, 02), Height.Platform_10m, AgeClass.B, 'F', 0, 0);
            competitionList.UpdateCompetition(updatedCompetition, competition);
            if (competitionList.competitionList[0].Name == "VM" &&
                competitionList.competitionList[0].Event == CompetitionType.International &&
                competitionList.competitionList[0].Location == "Sala" &&
                competitionList.competitionList[0].Date == new DateTime(2014, 02,02) &&
                competitionList.competitionList[0].Height == Height.Platform_10m &&
                competitionList.competitionList[0].AgeClass == AgeClass.B &&
                competitionList.competitionList[0].Gender == 'F' &&
                competitionList.competitionList[0].JudgingJudges == 0 &&
                competitionList.competitionList[0].RoundsInCompetition == 0)
                equal = true;
            else
                equal = false;

            Assert.AreEqual(equal, true);
            Console.Write(competitionList.competitionList[0].Name);
        }

        [Test]
        public void InitializeCompetitionList()
        {
            bool equal = false;
            CompetitionList compList = new CompetitionList();
            compList = compList.InitializeCompetitionList();
            if (compList.competitionList.Count > 1)
                equal = true;
            else
                equal = false;

            Assert.AreEqual(true, equal);
        }

    }
}
